package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {


    Page<Student> findAll(StudentQueryParam studentQueryParam);

    @Select("select * from student where id=#{id}")
    Student getById(Integer id);


    void deleteBatch(List<Integer> ids);

    void insert(Student student);

    void updateStudent(Student student);

    @Update("update student set violation_count=violation_count+1 ,violation_score=violation_score+#{score} where id=#{id}")
    void violation(Integer id, Integer score);

    List<Map> getStudentDegreeData();

    List<Map> getStudentCountData();
}
